import { useChatStore } from '@/store/chat';

export function createSearchAPI() {
  const chatStore = useChatStore();
  
  return {
    get sessionId() { return { value: chatStore.connectionState.searchSessionId } },
    get connected() { return { value: chatStore.connectionState.isSearchConnected } },
    get message() { return { value: chatStore.connectionState.searchMessage } },
    get loading() { return { value: chatStore.connectionState.searchLoading } },
    get error() { return { value: chatStore.connectionState.error } },
    
    sendMessage: (sessionId: string, message: string) => chatStore.sendSearchMessage(sessionId, message),
    close: () => {},
    clearMessage: () => chatStore.clearSearchMessage(),
    generateSessionId: () => chatStore.generateSessionId(),
    stopStream: () => chatStore.stopStream('search')
  };
}
